<style>
.{{$t|escape:'html'}}_main {
  border-left: 15px solid #eaf2f5;
  border-right: 15px solid #eaf2f5;
  width: 1200px;
}
.{{$t|escape:'html'}}_subtitle {
  background-color: #e5f1f5;
  padding: 7px 0 7px 10px;
  font-family: Arial Black;
}
.{{$t|escape:'html'}}_emphasis {
  background-color: #d6e3e8;
  font-weight: bold;
  font-family: Trebuchet MS;
}
table.{{$t|escape:'html'}}_category {
}
table.{{$t|escape:'html'}}_category td.title {
  font-weight: bold;
  text-align: right;
  padding: 2px 10px 2px 20px;
  margin-right: 20px;
  background-color: #d6e3e8;
  font-family: Trebuchet MS;
  width: 150px;
  height: 30px;
}
table.{{$t|escape:'html'}}_category td.content {
  width: 100px;
}
.{{$t|escape:'html'}}_select {
  width: 280px;
  height: 23px;
  margin-left: 4px; 
}

.{{$t|escape:'html'}}_text {
  width: 100px;
  height: 20px;
  margin-left: 4px;
}
.{{$t|escape:'html'}}_textarea {
  width: 275px;
  height: 80px;
  margin-left: 4px;
}
.{{$t|escape:'html'}}_button {
  margin-top: 10px; 
  margin-left: 3px; 
}
</style>
<div class="{{$t|escape:'html'}}_main">
  <div>
    <div class="{{$t|escape:'html'}}_subtitle" style="text-align: center;background-color: #eaf2f5;">
      <span class="image_button" style="width: 100px;" onclick="save();">
        <table>
          <tr>
            <td><img src="image/btn/save24.png"></img></td>
            <td>{{t escape='html'}}Save{{/t}}</td>
          </tr>
        </table>
      </span>
    </div>
  <div>
  <div class="{{$t|escape:'html'}}_subtitle">{{t escape='html'}}Basic Information{{/t}}</div>
  <table class="{{$t|escape:'html'}}_category">
    <tr>
      <td class="title">{{t escape='html'}}购买1元钱兑换{{/t}}</td>
      <td class="content">
        <input id="{{$t|escape:'html'}}_rate" type="text" class="{{$t|escape:'html'}}_text" value="{{if isset($point)}}{{$point->rate|escape:html}}{{/if}}"></input>
      </td>
      <td>积分</td>
      <td></td>
    </tr>
    <tr>
      <td class="title">{{t escape='html'}}中级会员门槛{{/t}}</td>
      <td class="content">
        <input id="{{$t|escape:'html'}}_level1" type="text" class="{{$t|escape:'html'}}_text" value="{{if isset($point)}}{{$point->level1|escape:html}}{{/if}}"></input>
      </td>
      <td>积分</td>
      <td></td>
    </tr>
    <tr>
      <td class="title">{{t escape='html'}}高级会员门槛{{/t}}</td>
      <td class="content">
        <input id="{{$t|escape:'html'}}_level2" type="text" class="{{$t|escape:'html'}}_text" value="{{if isset($point)}}{{$point->level2|escape:html}}{{/if}}"></input>
      </td>
      <td>积分</td>
      <td></td>
    </tr>
  </table>
  <div>
    <div class="{{$t|escape:'html'}}_subtitle" style="text-align: center;background-color: #eaf2f5;">
      <span class="image_button" style="width: 100px;" onclick="save();">
        <table>
          <tr>
            <td><img src="image/btn/save24.png"></img></td>
            <td>{{t escape='html'}}Save{{/t}}</td>
          </tr>
        </table>
      </span>
    </div>
  <div>
</div>

<script src="jsrequest.php?script={{$t|escape:'html'}}" type="text/javascript"></script>
<script type="text/javascript">
  <!--
    if (document.addEventListener) {
      document.addEventListener('DOMContentLoaded', init, false);
    }
    window.onload = init;
    var obj = { track_id: MiscUtils.unique(),
                rate: '',
                level1: '',
                level2: ''
              }
    var _point = {{if isset($point)}}JSON.parse('{{$point|@json_encode|escape:'javascript'}}'){{else}}obj{{/if}};

    function init() {
      if (!document.getElementById || !document.createElement || !arguments || arguments.callee._loaded) {
        return;
      }
      arguments.callee._loaded = true;
      
    }
    
    function save() {
      var rate = document.getElementById('{{$t|escape:javascript}}_rate');
      var level1 = document.getElementById('{{$t|escape:javascript}}_level1');
      var level2 = document.getElementById('{{$t|escape:javascript}}_level2');
      
      _point.rate = rate.value;
      _point.level1 = level1.value;
      _point.level2 = level2.value;

      new RequestUtils()._custom('ezobj', JSON.stringify({
        tbl : 'pz_ecom_point',
        obj : _point
      }), function(result, params) {
        location.href = 'admin.php?path=ecommerce&t=points';
      }, {
        php: 'custom.php'
      });
    }
  // -->
</script>